{// 加载头部公共文件 }
<include file="Public:header" />
<div class="main">
	<div class="content">
		<table id="checkList" class="list" cellpadding=0 cellspacing=0>
			<tr>
				<td height="3" colspan="2" class="toptd"></td>
			</tr>
			<tr class="row">
				<th colspan="2" class="space">玩家行为管理</th>
			</tr>
			<tr class="row">
				<td width="15%">玩家名称:</td>
				<td>
					<input type="text" id="uname" name="uname"/>
					<button onclick="checkUser()">查询</button>
					用户ID为:<span id="userinfo"></span>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">禁言管理:</td>
				<td>
					<button onclick="donttalk(1)">禁言</button>
					<input type="text" name="untalktime" id="untalktime" value=99 style="width:30px;"/>分钟
					<button onclick="donttalk(0)">解禁当前用户</button>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">踢人下线:</td>
				<td>
					<button onclick="kickUser()">踢人</button>
				</td>
			</tr>
			<tr class="row">
				<td width="15%">封/开角色(1为ban 其它为开):</td>
				<td>
					<button onclick="banUser(1)">封角色</button>
					<button onclick="banUser(0)">开角色</button>
				</td>
			</tr>
		</table>
	</div>
</div>
<!-- 主页面结束 -->
{// 加载尾部公共文件 }
<script type="text/javascript">
	var cdn_path	=	"http://1251001850.cdn.myqcloud.com/1251001850/xbmc/icon/goodsPic/";
	//封玩家号(角色)
	function banUser(type)
	{
		if(userid=="")
		{
			alert("先指定用户！");
			return;
		}
		var urldata	=	{};
		urldata.uid	=	userid;
		urldata.type	=	type;
		$.get("{:U('Game/banUser')}",urldata,function(data){
			if(type==1)
			{
				alert(username+"被封号了。");
			}
			else
			{
				alert(username+"帐号解封。");
			}
			
		});
	}
	
	//把玩家踢下去
	function kickUser()
	{
		if(userid=="")
		{
			alert("先指定用户！");
			return;
		}
		var urldata	=	{};
		urldata.uid	=	userid;
		$.get("{:U('Game/kickUser')}",urldata,function(data){
			alert(username+"被踢下线。");
		});
	}
	
	//设置禁言
	function donttalk(type)
	{
		if(userid=="")
		{
			alert("先指定用户！");
			return;
		}
		var talktime	=	0;
		if(type==1)
		{
			talktime	=	parseInt($("#untalktime").val());
		}
		else
		{
			talktime	=	0;
		}
		var urldata	=	{};
		urldata.uid	=	userid;
		urldata.type	=	talktime;
		$.get("{:U('Game/donttalk')}",urldata,function(data){
			if(type==1)
			{
				alert("禁言成功，"+username+"现在不能说话了。");
			}
			else
			{
				alert("解禁成功，"+username+"现在可以说话了。");
			}
		});
	}
	
	function resetAll()
	{
		
	}
	
	function enableAll()
	{
	}
	var userid	=	"";
	var username	=	"";
	/**
	* 检查玩家
	**/
	function checkUser()
	{
		username	=	$("#uname").val();
		var urldata	=	{};
		urldata.type	=	"user";
		urldata.name	=	username;
		//var econtent = escape(username);
		$.get("{:U('Game/query')}",urldata, function(data) {
			if(data=="")
			{
				//玩家不存在
				resetAll();
			}
			else
			{
				enableAll();
				userid	=	data;
				$("#userinfo").html(userid);
			}
		});
	}
	
</script>